package com.sumainfor.zuul.service.impl.Feign;

import com.alibaba.fastjson.JSONArray;
import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.zuul.dao.Feign.FeignDeptMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/1/18 15:53
 * @Description:
 */
@Service
public class FeignDeptService {

    Logger log= LoggerFactory.getLogger(FeignDeptService.class);

    @Autowired
    FeignDeptMapper deptMapper;

    /**
     * 功能描述:
     * 获取所有服务中心的列表
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/1/18 15:54
     */
    public List<Map<String,Object>> getDeptList(Map<String,Object>params){
        log.info("------------------------");
        log.info("------------------params:"+params);
        if(FieldCheckUtil.isMapFieldNotNull(params,new String[]{"MiIdList"})){
            List<String>MiIdList=(List<String>)params.get("MiIdList");
            if(MiIdList.size()==0){
                params.put("MiIdList",null);
            }
        }
        List<Map<String,Object>>getDeptList=deptMapper.getDeptList(params);
        return getDeptList;
    }

    /**
     * 功能描述:
     * 根据公司集合获取所有服务中心的列表
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/1/18 15:54
     */
    public List<Map<String,Object>> getAreaByDetLists(Map<String,Object>params){
        List<Map<String,Object>>getAreaByDetLists=deptMapper.getAreaByDetLists(params);
        return getAreaByDetLists;
    }

    /**
     * 功能描述:
     * 根据编号获取服务中心资料(包含。服务中心负责人)
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/7/11 16:28
     */
    public Map<String,Object>getDeptByDeptIdMap(Map<String,Object>params){
        return deptMapper.getDeptByDeptIdMap(params);
    }
}


